package flc.ast.fragment;

import android.os.Bundle;

import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import flc.ast.R;
import flc.ast.activity.RecentMakeActivity;
import flc.ast.databinding.FragmentEditBinding;
import flc.ast.databinding.FragmentHomeBinding;
import flc.ast.dialog.SelPicDialog;
import stark.common.basic.base.BaseNoModelFragment;
import stark.common.basic.event.EventStatProxy;

/**
 * A simple {@link Fragment} subclass.
 * Use the {@link EditFragment#newInstance} factory method to
 * create an instance of this fragment.
 */
public class EditFragment extends BaseNoModelFragment<FragmentEditBinding> {


    @Override
    protected int onCreate() {
        return R.layout.fragment_edit;
    }

    @Override
    protected void initView() {
        EventStatProxy.getInstance().statEvent1(getActivity(), mDataBinding.event1Container);
        EventStatProxy.getInstance().statEvent5(getActivity(), mDataBinding.event5Container);

        mDataBinding.rlRecentMake.setOnClickListener(this);
        mDataBinding.rlPicPuzzle.setOnClickListener(this);
        mDataBinding.rlPicCut.setOnClickListener(this);
        mDataBinding.ivAddFilter.setOnClickListener(this);
        mDataBinding.ivAddSticker.setOnClickListener(this);
        mDataBinding.ivAddText.setOnClickListener(this);
        mDataBinding.ivAddBackground.setOnClickListener(this);
    }

    @Override
    protected void onClickCallback(View v) {
        switch (v.getId()) {
            case R.id.rlRecentMake://最近项目
                startActivity(RecentMakeActivity.class);
                break;
            case R.id.rlPicPuzzle://图片拼图
                showSelPicDialog(0);
                break;
            case R.id.rlPicCut://图片切图
                showSelPicDialog(1);
                break;
            case R.id.ivAddFilter://添加滤镜
                showSelPicDialog(2);
                break;
            case R.id.ivAddSticker://添加贴纸
                showSelPicDialog(3);
                break;
            case R.id.ivAddText://添加文字
                showSelPicDialog(4);
                break;
            case R.id.ivAddBackground://添加文字
                showSelPicDialog(5);
                break;
        }
    }

    @Override
    protected void initData() {

    }

    private void showSelPicDialog(int type) {
        SelPicDialog selPicDialog = new SelPicDialog(mContext);
        selPicDialog.type = type;
        selPicDialog.show();
    }
}